import React, { Component } from 'react';
import Header from './common/header/index.js';
import store from './store/index.js';
import { Provider } from 'react-redux';
import { BrowserRouter, Route} from 'react-router-dom'
import Home from './pages/home';
import Detail from './pages/detail';
//当details组件变成了一个异步加载的组件就需要加载loadable.js这个组件
import Details from './pages/details/loadable.js';
import Login from './pages/login';
import Write from './pages/write';
class App extends Component {
  render() {
    return (
    	<Provider store={store}>
    	  <div>
                   {/*路由和路由规则*/}
            <BrowserRouter>
              <div>
                <Header />
                <Route exact path='/login' component={Login}></Route>
                <Route exact path='/details/:id' component={Details}></Route>
                <Route exact path='/' component={Home}></Route>
                <Route exact path='/write' component={Write}></Route>
                <Route exact path='/detail/:id' component={Detail}></Route>
              </div>
            </BrowserRouter>
          </div>
        </Provider>
    );
  }
}

export default App;
